<template>
  <div class="home">
    <h1>首页</h1>
    <ul>
      <li v-for="item in items" :key="item.id">{{ item.value }}</li>
    </ul>
    <p><router-link to="/list">进入列表</router-link></p>
  </div>
</template>

<script>
import Mock from 'mockjs'
import scroll from '@/mixins/scroll.js'
export default {
  name: 'Home',
  mixins: [scroll],
  data() {
    return {
      items: [],
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      const items = []
      for (let i = 0; i < 50; i++) {
        items.push({
          id: i,
          value: Mock.Random.sentence(5, 10),
        })
      }
      this.items = items
    },
  },
}
</script>
<style scoped>
.home {
  line-height: 30px;
}
</style>
